<%-- 
    Document   : cart
    Created on : 2019-9-16, 9:52:48
    Author     : danny
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@include file="/WEB-INF/jspf/top.jsp" %>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <h1>购物车!</h1>
        <div style="color: red">${error}</div>
        <c:if test="${empty ShoppingCart}">
            <h1>目前没有任何商品</h1>
        </c:if>
        <c:if test="${not empty ShoppingCart}"> 
            <a href="${contextPath}/cart?action=order">下订单</a>
            <table>
                <tr>
                    <th></th>
                    <th>商品名称</th>
                    <th>数量</th>
                    <th>金额</th>
                </tr>
                <c:forEach items="${ShoppingCart.items}" var="cartItem" varStatus="status">
                    <tr>
                        <td>${status.index+1}</td>
                        <td>${cartItem.product.epName}</td>
                        <td>${cartItem.quantity}</td>
                        <td>${cartItem.cost}</td>
                    </tr>
                </c:forEach>
            </table>
        </c:if>
            <h1>总金额：${ShoppingCart.cost}</h1>
</html>
